package service;

import dao.TeacherDao;
import entity.Teacher;
import exception.BysjException;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class TeacherService implements TeacherServiceInterface{
    private TeacherService(){
    }
    private static TeacherService teacherService;
    public static TeacherService getInstance(){
        if(teacherService == null){
            teacherService = new TeacherService();
        }
        return teacherService;
    }
    private TeacherDao teacherDao=TeacherDao.getInstance();
    @Override
    public Collection<Teacher> findAll(List<Condition> conditionList) throws SQLException, BysjException {
        Connection connection = JdbcHelper.getConn();
        return teacherDao.findAll(connection,conditionList);
    }

    @Override
    public Collection<Teacher> findAll(List<Condition> conditionList, Pagination pagination) throws SQLException, BysjException {
        Connection connection=JdbcHelper.getConn();
        return teacherDao.findAll(connection,conditionList,pagination);
    }
}
